<%@ page language="java" import="java.util.*,com.hs.chd.model.*,com.hs.core.utils.*,com.hs.core.cache.*" pageEncoding="utf-8"%>
<%
	String periodicalname = (String)request.getAttribute("periodicalname");
	String title = (String)request.getAttribute("title"); 
	String orderName = (String)request.getAttribute("orderName");
	String orderNum = (String)request.getAttribute("orderNum"); 
	String startdate = (String)request.getAttribute("startdate");
    String enddate = (String)request.getAttribute("enddate");
    String pagenum = (String)request.getAttribute("pagenum");
    String pagecount = (String)request.getAttribute("pagecount");
    String pagestr = (String)request.getAttribute("pagestr");
    List  dataList = (List)request.getAttribute("datalist");
    String  datatype = (String)request.getAttribute("datatype"); 
   
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<%@ include file="../../../include.jsp"%> 
<script src='<%=basePath%>dwr/interface/dataHelper.js'></script>  
<script language="javascript" type="text/javascript" src="<%=path %>/thirtpart/My97DatePicker/WdatePicker.js"></script>


<script language=JavaScript>
  //查询
 function searchData()
{
   
	document.searchform.submit();
}
//删除 
 function deletePaper(id){
 	var ids = document.getElementsByName("paperid");    
    var idstr = "";          
    for (var i = 0; i < ids.length; i++)               
    {                     
           if(ids[i].checked){
           	 idstr += ids[i].value+",";
           }            
    }    
    if(idstr == ""){
    	alert("请先选择要删除的文献!");
    	return;
    }else{
	 	if(confirm("确定要删除所选择的文献吗?")){
	 		dataHelper.deleteCNPaper(idstr,callback4delete); 
	 	}
 	}
 }

 function callback4delete(message){
    if("0" == message)
 	    alert("该文献信息已经被医案信息引用，不能够删除");  
 	else{
 	   alert("成功删除期刊文献信息!");
 	   document.searchform.submit();
 	} 
 }
 function deletePaperFile(){
    var ids = document.getElementsByName("paperid");    
    var idstr = "";          
    for (var i = 0; i < ids.length; i++)               
    {                     
           if(ids[i].checked){
           	 idstr += ids[i].value+",";
           }            
    }    
    if(idstr == ""){
    	alert("请先选择要删除的文献原文!");
    	return;
    }else{
	 	if(confirm("确定要删除所选择的文献原文吗?")){
	 		dataHelper.deleteCNPaperFile(idstr,callback4delete1); 
	 	}
 	} 
 } 
function callback4delete1(message){  
 	document.searchform.submit(); 
}
 function exportData()
{
    var papers = getSelectPaper();
    if('' == papers){
    	alert('请选择要导出的文献!');
    	return;
    }
	document.dataform.action="<%=basePath%>data/mod/exportData.do?ids="+papers;	
  	document.dataform.submit();
}
//题录信息
 function magaInfo(id)
{
	var pageURL = "<%=basePath %>data/magainfo.do?id=" + id;
	openwindow(pageURL,'800','600','书籍信息'); 
}
function getSelectPaper(){
	var ids = document.getElementsByName("paperid");    
    var idstr = "";          
    for (var i = 0; i < ids.length; i++)               
    {                     
           if(ids[i].checked){
           	 idstr += ids[i].value+",";
           }            
    }     
    return idstr;
}
function displayAttchImg(pid){
	var str = 'img_'+pid; 
	var target =  document.getElementById(str);  
	target.style.display='block';  
}
function downloadpdf(pid){
	openwindow('<%=basePath%>data/mod/downloadFile.do?pid='+pid,'0','0','');
}
</script>
</head>
<body> 
<div class="contlist"> 
<form name="searchform" action="<%=basePath %>data/mod/moddatalist.do" method="post">
 <table border="0" cellpadding="0" cellspacing="0" style="margin-bottom:0" class="sear_index">
                  <tr>
                    <td class="tar" width="60%">
                     <label>题名：<input type="text" name="title" value="<%=title==null?"":title %>"  style="width:12%" />
                    </label> 
                    <label>刊名：<input type="text" name="periodicalname" value="<%=periodicalname==null?"":periodicalname %>" style="width:12%"/>
                    </label>
                    <label>导入时间从： 
                    <input type="text" class="Wdate" id="startdate" value="<%=startdate==null?"":startdate %>" style="width:12%" name="startdate"  onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'enddate\')}',el:'startdate',dateFmt:'yyyy-MM-dd'})"  />
                    </label> 
                    <label>至：
                    <input type="text" class="Wdate" id="enddate" value="<%=enddate==null?"":enddate %>" style="width:12%" name="enddate"  onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startdate\')}',el:'enddate',dateFmt:'yyyy-MM-dd'})"  /> 
                    </label>
                    </td> 
                    <td class="tar">
                   
                    <input name="" type="button" class="btn btn-primary" onclick="searchData();"  value=" 查 询 "/>
                    <input name="" type="button" class="btn btn-primary" onclick="exportData();" value=" 导 出 "/>
                    <input name="" type="button" class="btn btn-primary" onclick="deletePaper();" value=" 删  除 "/>
                    <input name="" type="button" class="btn btn-primary" onclick="deletePaperFile();" value=" 删除原文 "/> 
                    </td>
                    </tr>
                </table>
</form>
    <div class="listWrap">
     
       <table border="0" cellpadding="0" cellspacing="0" class="tableList">
       <form name="dataform" action="<%=basePath %>data/mod/exportData.do?1=1" method="post">
      <tr>
        <th width="5%">
         选择
        </th> 
        <th width="25%"><a href="javaScript:orderPage('title','<%=OrderTool.getOrderNum("title",orderName,orderNum)%>');">题名&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("title",orderName,orderNum))%></a></th> 

        <th width="5%">原文</th>
        <th width="15%">刊名</th>
        <th width="10%"><a href="javaScript:orderPage('author','<%=OrderTool.getOrderNum("author",orderName,orderNum)%>');">作者&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("author",orderName,orderNum))%></a></th>
        <th width="20%">作者单位</th> 
        <th width="10%">发表时间</th>
         <th width="10%"><a href="javaScript:orderPage('impdate','<%=OrderTool.getOrderNum("impdate",orderName,orderNum)%>');">导入时间&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("impdate",orderName,orderNum))%></a></th>
      </tr>
      <%if(null != dataList&&dataList.size()>0){
      		for(int i =0;i<dataList.size();i++){
      			Map paper = (Map)dataList.get(i); 
       %>
      <tr>
        <td class="tac" nowrap><input type="checkbox" name="paperid" id="paperid" value="<%=paper.get("id") %>" />
         
        </td>
         <td><%=paper.get("title") %></td>
         <td class="tac"><span id="img_<%=paper.get("ID")%>" style="display:<%if((paper.get("Isimg")+"").equals("1")){ out.print("");}else{ out.print("none");}%>"> 
        <a href="javascript:downloadpdf('<%=paper.get("id")%>');">下载</a></span></td>
        <td><%=StringUtilTool.NULL2Blank(paper.get("periodicalname")+"") %></td>
        <td><%=StringUtilTool.NULL2Blank(paper.get("author")+"") %></td>
        <td><%=StringUtilTool.NULL2Blank(paper.get("authorunit")+"") %></td> 
        <td class="tac"><%=StringUtilTool.NULL2Blank(paper.get("yearstr")+"") %></td>
         <td class="tac"><%=paper.get("impdate")%></td>
      </tr>
      
      <%}}else{ %>
      <tr>
        <td class="tac" colspan=8><font color=red><strong>没有现代文献数据!</strong></font></td>
      </tr> 
      <%} %>
    </table>
    </form>
    </div> 
    <div class="pageWrap">
        <div class="result"><input onclick="selectAll(true,'paperid');" type="button" value="全选" class="btn btn-primary"/>
        <input onclick="selectAll(false,'paperid');" type="button" value="清除" class="btn btn-primary"/> </div>
        <div class="page">
              <%=pagestr %>
        </div>
    </div>
</div>
</body>
</html>